String clazzTpl({package}) => """
import 'generated/l10n.dart';
import 'store/app_state.dart';
import 'utils/print_util.dart';
import 'route/main.route.dart';
import 'package:xanno/xanno.dart';
import 'debug/app_debug_model.dart';
import 'store/user/user_state.dart';
import 'package:flutter/material.dart';
import 'package:observable_builder/observable_builder.dart';
import 'package:flutter_localizations/flutter_localizations.dart';

@GApi(enable: true)
@GColor(enable: true)
@GSize(enable: true)
@GAssets(path: 'assets')
@GFormatter(enable: true)
//@GIconfont(url: '//at.alicdn.com/t/font_xxxx_g48kd9v3h54.js')
class App extends StatefulWidget {
  final String route;

  const App({Key? key, required this.route}) : super(key: key);

  @override
  _AppState createState() => _AppState();
}

class _AppState extends State<App> {
  @override
  Widget build(BuildContext context) {
    return ObservableBuilder<UserState>(
      create: AppState.observableUser,
      memo: (state) => [state.appDebug],
      builder: (context, state) {
        return MaterialApp(
          localizationsDelegates: [
            S.delegate,
            GlobalMaterialLocalizations.delegate,
            GlobalWidgetsLocalizations.delegate,
            GlobalCupertinoLocalizations.delegate,
          ],
          supportedLocales: S.delegate.supportedLocales,
          theme: ThemeData(
            platform: TargetPlatform.iOS,
            brightness: Theme.of(context).brightness,
            splashColor: Colors.transparent,
            highlightColor: Colors.transparent,
            primaryColorBrightness: Brightness.light,
          ),
          navigatorKey: globalNavigatorKey,
          debugShowCheckedModeBanner:
              state.findAppDebug(AppDebugKey.debugBanner),
          initialRoute: RouteConstant.MainPage,
          routes: routes(context),
          navigatorObservers: [
            NavObserver(),
          ],
        );
      },
    );
  }
}

class NavObserver extends NavigatorObserver {
  @override
  void didPush(Route route, Route? previousRoute) {
    logDebugPrint('push \${route.settings.name}');
  }

  @override
  void didPop(Route route, Route? previousRoute) {
    logDebugPrint('pop \${route.settings.name}');
  }

  @override
  void didReplace({Route? newRoute, Route? oldRoute}) {
    logDebugPrint('replace \${newRoute!.settings.name}');
  }
}
""";
